function ListNode(x){
    this.val = x;
    this.next = null;
}
function deleteDuplication(pHead)
{
    // write code here
    var dummy = new ListNode(-1)
    var tail = dummy
    while(pHead){
      if(pHead.next === null || pHead.val !== pHead.next.val){
        tail.next = pHead
        tail = pHead
        pHead = pHead.next
      }else{
        while(pHead.next !== null && pHead.val === pHead.next.val){
          pHead = pHead.next
        }
        pHead = pHead.next
        if(pHead === null){
          tail.next = pHead
          tail = pHead
        }
      }
    }
    return dummy.next
}
module.exports = {
    deleteDuplication : deleteDuplication
};